// Description: 全局变量

const SINGLE_CELL = 0
const PATTERN = 1

var GLOBAL_CONFIG = {
  //可控参数
  running: true, //运行/暂停
  cellSize: 20, //网格大小
  cells: [], //function() {
  animationSpeed: 1000, // 动画速度，以毫秒为单位
  handle: null, //定时器句柄
  isRunning: false,
  isMouseDown: false,
  generation: 0,
  currentPattern: patterns[0],
  currentStatus: 0,     //0: 单细胞放置，1：模式放置
  currentMouse:{
    x: 0,
    y: 0,
  },
}

//不可控参数
var gridHeight = Math.floor(window.innerHeight / GLOBAL_CONFIG.cellSize)
var gridWidth = Math.floor(window.innerWidth / GLOBAL_CONFIG.cellSize)


function rotateCurrentPattern(){
  if (GLOBAL_CONFIG.currentPattern == null) return
  GLOBAL_CONFIG.currentPattern.rotate()
}
